package com.qfedu.openplateform.manager.service.impl;

import com.qfedu.openplateform.manager.dao.CustomerMapper;
import com.qfedu.openplateform.manager.dao.RechargeMapper;
import com.qfedu.openplateform.manager.entity.Customer;
import com.qfedu.openplateform.manager.entity.Recharge;
import com.qfedu.openplateform.manager.service.RechargeServcie;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author Mr.Li
 * @date 2021/10/27 19:03
 * @className RechargeServcieImpl
 * @description 充值管理服务实现层
 */
@Service
@Transactional
public class RechargeServcieImpl implements RechargeServcie {

    @Autowired
    private RechargeMapper rechargeMapper;

    @Autowired
    private CustomerMapper customerMapper;

    // 查询所有
    @Override
    public List<Recharge> findAll() {
        return rechargeMapper.findAll();
    }

    @Override
    public void del(int[] ids) {
        for (int id : ids) {
            rechargeMapper.del(id);
        }

    }

    @Override
    public void add(Recharge recharge) {
        // 创建充值订单
        rechargeMapper.add(recharge);
    }

    @Override
    public void update(Recharge recharge) {
        rechargeMapper.update(recharge);
    }
}
